

{assign value=$lead->edo->fetch($fObject->getValue()) var=selectd}
<input type="text" id="{$fObject->getName()}_fake_field" name="" value="{$selectd->name}"/>
<input type="hidden" id="{$fObject->getName()}" name="{$fObject->getName()}" value="{$selectd->edoid}"/>

<div id="autocomplete_choices" class="autocomplete_choices"></div>

<script type="text/javascript">
function updateCompanyList(elem)
{literal}
{
	var content = elem.innerHTML;

	// var rx = new RegExp("(.*?)<span class=\"hidden_edoid\">(.*?)<\/span>");
	var rx = new RegExp("(.*?)<SPAN class=hidden_edoid>(.*?)<\/SPAN>");

	
	var arrMatches = rx.exec(content);
	//alert(content);
	//alert(arrMatches);
	var displayName = arrMatches[1];
	var edoid = arrMatches[2];
	var fobjName = "{/literal}{$fObject->getName()}{literal}";
	
	var strippedDisplay = displayName.replace(/(<([^>]+)>)/ig,""); 
	$(fobjName+"_fake_field").value=strippedDisplay;
	$(fobjName).value=edoid;
	
}
{/literal}
var acConfig = 
{literal}{{/literal}
	updateElement:updateCompanyList,
	paramName:"{$fObject->getName()}_field"
{literal}}{/literal}

new Ajax.Autocompleter("{$fObject->getName()}_fake_field", "autocomplete_choices", "/company/ajaxlist", acConfig);
</script>

{*
<select id="{$fObject->getName()}" name="{$fObject->getName()}">
{if $config.nulloption}
<option value="{$config.nulloption.key}" {if $config.nulloption.key == $fObject->getValue()} selected="selected" {/if}>{$config.nulloption.value}</option>
{/if}
{foreach name=options from=$fObject->getOptions() item=option key=key}
<option {if $option.rkey == $fObject->getValue()} selected="selected" {/if} value="{$option.rkey}">{$option.rvalue}</option>
{/foreach}
</select>
*}
